<?php

namespace app\api\validate;


use \think\Validate;

/**
 *  订单验证类
 */
class Order extends Validate
{
    protected $rule = [
        'id'=> 'require|number',
        'user_id'=> 'require|number',
        'ids' => 'require|array',
        'address_id' => 'require|number',
        'is_wholesal' => 'require|number|in:1,2',
        'payment_method_id' => 'require|number',
        'payment_method' => 'require|number',
        'billing_address' => 'require|number',
        'page' => 'require|number',
        'listRows' => 'require|number',
        'status' => 'require',
        'orderNo' => 'require',
        'file' => 'require|file',
        'pickup_name' => 'require',
        'pickup_phone' => 'require',
        'pickup_passport' => 'require',
        'method.require' => 'require',
        'product.require' => 'require',
        'quantity.require' => 'require',
        'is_futures.require' => 'require',
        'arrival_date.require' => 'require',
        'wid.require' => 'require',
    ];

    //定义验证提示
    protected $message = [
        'id.require' => 'common.idRequire',
        'id.number' => 'common.idNumber',
        'page.require' => 'common.pageRequire',
        'page.number' => 'common.pageNumber',
        'listRows.require' => 'common.listRowsRequire',
        'listRows.number' => 'common.listRowsNumber',
        'status.require' => 'common.statusRequire',
        'user_id.require' => 'order.userIdRequire',
        'user_id.number' => 'order.userIdNumber',
        'ids.require' => 'order.idsRequire',
        'ids.array' => 'order.idsArray',
        'address_id.require' => 'order.addressIdRequire',
        'address_id.number' => 'order.addressIdNumber',
        'is_wholesal.require' => 'order.isWholesalRequire',
        'is_wholesal.number' => 'order.isWholesalNumber',
        'is_wholesal.in' => 'order.isWholesalIn',
        'payment_method_id.require' => 'order.paymentMethodIdRequire',
        'payment_method_id.number' => 'order.paymentMethodIdNumber',
        'payment_method.require' => 'order.paymentMethodRequire',
        'payment_method.number' => 'order.paymentMethodNumber',
        'billing_address.require' => 'order.billingAddressRequire',
        'billing_address.number' => 'order.billingAddressNumber',
        'billing_address_id.require' => 'order.billingAddressIdRequire',
        'billing_address_id.number' => 'order.billingAddressIdNumber',
        'orderNo.require' => 'order.orderNoRequire',
        'method.require' => 'order.methodRequire',
        'product.require' => 'order.productRequire',
        'file.require' => 'order.fileRequire',
        'file.file' => 'order.fileFile',
        'pickup_name.require' => 'order.pickupNameRequire',
        'pickup_phone.require' => 'order.pickupPhoneRequire',
        'quantity.require' => 'order.quantityRequire',
        'is_futures.require' => 'order.isFuturesRequire',
        'arrival_date.require' => 'order.arrivaDateRequire',
        'wid.require' => 'order.widRequire',
        'pickup_passport.require' => 'order.pickupPassportRequire'

    ];

    //定义验证场景
    protected $scene = [
        'checkout' => ['user_id', 'method','product'],
        'order' => ['user_id', 'ids','is_wholesal','delivery_method','pay_terms','advance_amount'],
        'wholesal' => ['user_id', 'ids','is_wholesal','pay_terms','advance_amount'],
        'logisticsCart' => ['user_id', 'ids','address_id','shipping_method_id'],
        'list' => ['user_id','page','listRows','status','search_value'],
        'detail' => ['orderNo'],
        'payment_voucher' => ['user_id','orderNo','file'],
        'voucher_remove' => ['id'],
        'payment' => ['orderNo','payment_method'],
        'pickup' => ['pickup_name','pickup_phone','pickup_passport'],
        'calculatePrice' => ['id','wid','arrival_date','is_futures','quantity'],
        'cancel' => ['orderNo']
    ];

}
